<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="id" name="id" value="${linInfoAll.id!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">线路编号</label>
              <div class="layui-input-block">
                  <input type="text" id="lineNo" name="lineNo" value="${linInfoAll.lineNo!}"  autocomplete="off" placeholder="请输入线路编号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">线路名称</label>
              <div class="layui-input-block">
                  <input type="text" id="lineName" name="lineName" value="${linInfoAll.lineName!}"  autocomplete="off" placeholder="请输入线路名称"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">上下行</label>
              <div class="layui-input-block">
                  <input type="text" id="isUpDown" name="isUpDown" value="${linInfoAll.isUpDown!}"  autocomplete="off" placeholder="请输入上下行"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">站点总数</label>
              <div class="layui-input-block">
                  <input type="text" id="stationSum" name="stationSum" value="${linInfoAll.stationSum!}"  autocomplete="off" placeholder="请输入站点总数"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">首班时间</label>
              <div class="layui-input-block">
                  <input type="text" id="firstTime" name="firstTime" value="${linInfoAll.firstTime!}"  autocomplete="off" placeholder="请输入首班时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">末班时间</label>
              <div class="layui-input-block">
                  <input type="text" id="lastTime" name="lastTime" value="${linInfoAll.lastTime!}"  autocomplete="off" placeholder="请输入末班时间"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">开始站点编号</label>
              <div class="layui-input-block">
                  <input type="text" id="beginStation" name="beginStation" value="${linInfoAll.beginStation!}"  autocomplete="off" placeholder="请输入开始站点编号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">结束站点编号</label>
              <div class="layui-input-block">
                  <input type="text" id="endStation" name="endStation" value="${linInfoAll.endStation!}"  autocomplete="off" placeholder="请输入结束站点编号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">首站名称</label>
              <div class="layui-input-block">
                  <input type="text" id="beginStationName" name="beginStationName" value="${linInfoAll.beginStationName!}"  autocomplete="off" placeholder="请输入首站名称"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">末站名称</label>
              <div class="layui-input-block">
                  <input type="text" id="endStationName" name="endStationName" value="${linInfoAll.endStationName!}"  autocomplete="off" placeholder="请输入末站名称"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">票价</label>
              <div class="layui-input-block">
                  <input type="text" id="ticket" name="ticket" value="${linInfoAll.ticket!}"  autocomplete="off" placeholder="请输入票价"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         id:$("#id").val(),
                         lineNo:$("#lineNo").val(),
                         lineName:$("#lineName").val(),
                         isUpDown:$("#isUpDown").val(),
                         stationSum:$("#stationSum").val(),
                         firstTime:$("#firstTime").val(),
                         lastTime:$("#lastTime").val(),
                         beginStation:$("#beginStation").val(),
                         endStation:$("#endStation").val(),
                         beginStationName:$("#beginStationName").val(),
                         endStationName:$("#endStationName").val(),
                           ticket:$("#ticket").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/bus/linInfoAll/editLinInfoAll",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/bus/linInfoAll/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#lineNo").val().length<1){
                       layer.msg("请输入线路编号");
                       return false;
                   }
                   if($("#lineName").val().length<1){
                       layer.msg("请输入线路名称");
                       return false;
                   }
                   if($("#isUpDown").val().length<1){
                       layer.msg("请输入上下行");
                       return false;
                   }
                   if($("#stationSum").val().length<1){
                       layer.msg("请输入站点总数");
                       return false;
                   }
                   if($("#firstTime").val().length<1){
                       layer.msg("请输入首班时间");
                       return false;
                   }
                   if($("#lastTime").val().length<1){
                       layer.msg("请输入末班时间");
                       return false;
                   }
                   if($("#beginStation").val().length<1){
                       layer.msg("请输入开始站点编号");
                       return false;
                   }
                   if($("#endStation").val().length<1){
                       layer.msg("请输入结束站点编号");
                       return false;
                   }
                   if($("#beginStationName").val().length<1){
                       layer.msg("请输入首站名称");
                       return false;
                   }
                   if($("#endStationName").val().length<1){
                       layer.msg("请输入末站名称");
                       return false;
                   }
                   if($("#ticket").val().length<1){
                       layer.msg("请输入票价");
                       return false;
                   }
        }
    });

</script>
</body>
</html>